// package main

// import (
// 	"encoding/json"
// 	"fmt"
// 	"reflect"
// )

// type Vedio struct {
// 	vedio   string `json:"vedioooo"`
// 	picture string `info:"图片"`
// }

// type Infocontext struct {
// 	Date Vedio
// }

// func Findtag(arg interface{}) {
// 	t := reflect.TypeOf(arg).Elem()

// 	for i := 0; i < t.NumField(); i++ {
// 		infostr := t.Field(i).Tag.Get("info")
// 		jsonstr := t.Field(i).Tag.Get("json")
// 		fmt.Printf("infostr: %s, jsonstr : %s", infostr, jsonstr)

// 	}
// }

// func main() {
// 	fmt.Println("hello")
// 	var hash []map[string]string

// 	hash = append(hash, map[string]string{"linying": "kugou"})
// 	hash = append(hash, map[string]string{"linmanbing": "wusuo"})
// 	hash = append(hash, map[string]string{"ruanjiyu": "dazu"})

// 	for index, result := range hash {
// 		fmt.Printf("index: %d, result: %+v\n", index, result)
// 	}

// 	//bilibili := Infocontext{Vedio{"hahahah", "美团"}}
// 	bilibili := Vedio{"hahahah", "美团"}
// 	fmt.Println(bilibili)
// 	Findtag(bilibili)

// 	shipin := Vedio{"腾讯视频", "扣篮视频"}

// 	jsonstr, _ := json.Marshal(shipin)
// 	fmt.Println(jsonstr)
// 	var aiqiyi Vedio
// 	json.Unmarshal(jsonstr, &aiqiyi)
// 	fmt.Printf("%v\n", aiqiyi)

// 	// for index, item := range sliceOfMaps {
// 	//     fmt.Printf("Index: %d, Map: %+v\n", index, item)
// 	//

// }

package main

import (
	"encoding/json"
	"fmt"
	"reflect"
)

type Movie struct {
	Title  string   `info:"title" messge:"subtitle"`
	Price  int      `info:"price"`
	Actors []string `messge:"actors"`
	Year   string   `info:"year" messge:"thisyear"`
}

type TV struct {
	Title  string   `json:"title"`
	Price  int      `json:"price"`
	Actors []string `json:"actors"`
	Year   string   `json:"year"`
}

func FindTag(arg interface{}) {
	t := reflect.TypeOf(arg).Elem()

	for i := 0; i < t.NumField(); i++ {
		infostr := t.Field(i).Tag.Get("info")
		messstr := t.Field(i).Tag.Get("messge")
		fmt.Printf("infostr: %s, messgestr: %s\n", infostr, messstr)
	}
}

func main() {
	movie := Movie{"西红柿首富", 40, []string{"沈腾", "大东"}, "2018"}
	FindTag(&movie)

	NBA := TV{"金州勇士", 50000, []string{"斯蒂芬库里", "克莱汤普森"}, "2022"}
	jsonstr, err := json.Marshal(NBA)
	if err != nil {
		fmt.Println("json fail")
		return
	}

	fmt.Printf("jsonstr : %s\n", jsonstr)

	var CBA = TV{}
	json.Unmarshal(jsonstr, &CBA)
	fmt.Printf("CBA : %v\n", CBA)
	fmt.Println(CBA)

	var Good = []map[string]string{}
	Good = append(Good, map[string]string{"林颖 -> ": " 腾云音乐娱乐集团"})
	Good = append(Good, map[string]string{"林炼东 -> ": " 医疗"})
	Good = append(Good, map[string]string{"林漫冰 -> ": " 工业和信息部第五研究所"})

	for index, hash := range Good {
		fmt.Println(index, hash)
	}

}
